package goComfyuiApi

// 获取执行结果中的图片
func ApiGetWorkflowOutputTexts(comfyuiUrl, promptID string) ([]string, error) {
	outTexts := []string{}

	taskInfo, err := getWorkflowOutput(comfyuiUrl, promptID)
	if err != nil {
		return outTexts, err
	}

	if taskInfo == nil {
		return outTexts, nil
	}

	outputs := taskInfo.Outputs
	// 遍历outputs
	for _, o := range outputs {
		for i := 0; i < len(o.Text); i++ {
			str := o.Text[i]
			outTexts = append(outTexts, str)
		}
	}

	return outTexts, nil
}
